package com.zjgxzh.userservice.mapper;

import com.zjgxzh.userservice.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {

    @Select("SELECT * FROM user WHERE username = #{username}")
    User findByUsername(String username);

    @Select("SELECT password FROM user WHERE username = #{username}")
    String findPasswordByUsername(String username);

    @Select("SELECT id FROM user WHERE username = #{username}")
    String findIdByUsername(String username);

    @Insert("INSERT INTO user (username, password, email) VALUES (#{username},#{password},#{email})")
    void addUser(User user);
}
